<#include "../../common/head.html"/>
<#include "../../common/left.html"/>
<!--本网页自己的内容-->
<#macro content >
<section class="Hui-article-box">
    <div class="pd-20">
        <form class="form form-horizontal" id="myRepwdForm">
            <div class="row cl">
                <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>原密码：</label>
                <div class="formControls col-xs-10 col-sm-10">
                    <input type="password" class="input-text " value="" placeholder="" id="oldPwd" name="oldPwd">
                </div>
            </div>

            <div class="row cl">
                <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>新密码：</label>
                <div class="formControls col-xs-10 col-sm-10">
                    <input type="password" class="input-text " value="" placeholder="" id="pwd" name="pwd">
                </div>
            </div>

            <div class="row cl">
                <label class="form-label col-xs-2 col-sm-2"><span class="c-red">*</span>确认新密码：</label>
                <div class="formControls col-xs-10 col-sm-10">
                    <input type="password" class="input-text " value="" placeholder="" id="rePwd" name="rePwd">
                </div>
            </div>

            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <input id="myRepwdFormBtn" class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                </div>
            </div>
        </form>
    </div>
</section>
</#macro>
<!--本网页自己的css js -->
<#assign js>
<script type="text/javascript" src="/res/lib/jquery.validation/1.14.0/jquery.validate.ext.js"></script>
<script type="text/javascript">
    $(document).ready(function (e) {
        $("#myRepwdForm").validate({
            rules:{
                oldPwd:{
                    required:true
                },
                pwd:{
                    required:true,
                    minlength:6,
                    maxlength:16
                },
                rePwd:{
                    equalTo:'#pwd'
                }
            },
            onkeyup:false,
            focusCleanup:false,
            success:"valid",
            submitHandler:function(form){
                $.ajax({
                    url:'/core/my/repwd/validate',
                    type:'post',
                    data:$("#myRepwdForm").serialize(),
                    dataType:'json',
                    success:function (json) {
                        if(json.errno==0){
                            parent.layer.alert('操作成功', function(index){
                                window.top.location.href='/logout';
                            });
                        }else{
                            layer.alert('操作失败，'+json.msg);
                        }
                    }
                });
            }
        });
    });
</script>
</#assign>
<!--#布局-->
<#include "../../common/layout.html" />